package com.da.javatest.leetCode;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * @author chenlida
 * @date 2019/1/7 10:44
 * @description
 */
public class Code893 {
    public static void main(String[] args) {
        new Code893().numSpecialEquivGroups(new String[] {"a", "b", "c", "a", "c", "c"});
    }

    public int numSpecialEquivGroups(String[] A) {
        Set<String> set = new HashSet<>();
        for (String s : A) {
            StringBuilder sb1 = new StringBuilder();
            StringBuilder sb2 = new StringBuilder();
            char[] chars = s.toCharArray();
            for (int i = 0; i < chars.length; i++) {
                if (i % 2 == 0) {
                    sb1.append(chars[i]);
                } else {
                    sb2.append(chars[i]);
                }
            }
            char[] c1 = sb1.toString().toCharArray();
            char[] c2 = sb2.toString().toCharArray();
            Arrays.sort(c1);
            Arrays.sort(c2);
            set.add(Arrays.toString(c1) + Arrays.toString(c2));
        }
        return set.size();
    }
}
